package com.hx.base.old;

import java.io.InputStream;
import java.io.InputStreamReader;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;

/**
 * @author jxlgcmh
 * @date 2019-08-08 19:29
 */
public class Demo3 {
    public static void main(String[] args) throws Exception {
        Class<System> systemClass = System.class;
        Field in = systemClass.getField("in");
        Class<InputStreamReader> inputStreamReaderClass = InputStreamReader.class;
        Constructor<InputStreamReader> constructor = inputStreamReaderClass.getConstructor(InputStream.class);


        constructor.setAccessible(true);
        InputStreamReader inputStreamReader = constructor.newInstance(in);


        System.out.println(inputStreamReader);
    }
}
